// 模拟数据库表结构 - 新增原始表和目标表定义
export const dbTables = {
  "客户信息表": [
    { name: "customer_id", type: "VARCHAR", required: true, comment: "用户唯一标识", dataType: "VARCHAR(20)" },
    { name: "full_name", type: "VARCHAR", required: true, comment: "用户全名", dataType: "VARCHAR(50)" },
    { name: "gender", type: "CHAR", required: false, comment: "用户性别", dataType: "CHAR(1)" },
    { name: "birth_date", type: "DATE", required: false, comment: "用户出生日期", dataType: "DATE" },
    { name: "phone", type: "VARCHAR", required: true, comment: "用户电话", dataType: "VARCHAR(15)" },
    { name: "email", type: "VARCHAR", required: false, comment: "用户邮箱", dataType: "VARCHAR(100)" },
    { name: "address", type: "VARCHAR", required: false, comment: "用户地址", dataType: "VARCHAR(200)" },
    { name: "city", type: "VARCHAR", required: false, comment: "用户城市", dataType: "VARCHAR(30)" },
    { name: "province", type: "VARCHAR", required: false, comment: "用户省份", dataType: "VARCHAR(20)" },
    { name: "postal_code", type: "VARCHAR", required: false, comment: "用户邮编", dataType: "VARCHAR(10)" },
    { name: "register_date", type: "TIMESTAMP", required: true, comment: "用户注册日期", dataType: "TIMESTAMP" },
    { name: "last_update", type: "TIMESTAMP", required: true, comment: "最后更新时间", dataType: "TIMESTAMP" }
  ],
  "订单表": [
    { name: "order_id", type: "VARCHAR", required: true, comment: "订单ID", dataType: "VARCHAR(20)" },
    { name: "customer_id", type: "VARCHAR", required: true, comment: "客户ID", dataType: "VARCHAR(20)" },
    { name: "order_date", type: "TIMESTAMP", required: true, comment: "订单日期", dataType: "TIMESTAMP" },
    { name: "total_amount", type: "DECIMAL", required: true, comment: "订单总额", dataType: "DECIMAL(10,2)" },
    { name: "payment_method", type: "VARCHAR", required: true, comment: "支付方式", dataType: "VARCHAR(20)" },
    { name: "status", type: "VARCHAR", required: true, comment: "订单状态", dataType: "VARCHAR(20)" },
    { name: "shipping_address", type: "VARCHAR", required: true, comment: "配送地址", dataType: "VARCHAR(200)" },
    { name: "shipping_city", type: "VARCHAR", required: true, comment: "配送城市", dataType: "VARCHAR(30)" },
    { name: "shipping_province", type: "VARCHAR", required: true, comment: "配送省份", dataType: "VARCHAR(20)" },
    { name: "shipping_postal_code", type: "VARCHAR", required: true, comment: "配送邮编", dataType: "VARCHAR(10)" },
    { name: "delivery_date", type: "DATE", required: false, comment: "配送日期", dataType: "DATE" },
  ],
  "产品表": [
    { name: "product_id", type: "VARCHAR", required: true, comment: "产品ID", dataType: "VARCHAR(20)" },
    { name: "product_name", type: "VARCHAR", required: true, comment: "产品名称", dataType: "VARCHAR(100)" },
    { name: "category", type: "VARCHAR", required: true, comment: "产品分类", dataType: "VARCHAR(50)" },
    { name: "price", type: "DECIMAL", required: true, comment: "产品价格", dataType: "DECIMAL(10,2)" },
    { name: "stock", type: "INTEGER", required: true, comment: "库存数量", dataType: "INTEGER" },
    { name: "description", type: "TEXT", required: false, comment: "产品描述", dataType: "TEXT" },
    { name: "created_at", type: "TIMESTAMP", required: true, comment: "创建时间", dataType: "TIMESTAMP" },
    { name: "updated_at", type: "TIMESTAMP", required: true, comment: "更新时间", dataType: "TIMESTAMP" },
  ],
  
  // 新增原始表定义
  "old_customer": [
    { name: "uuid", type: "VARCHAR", required: true, comment: "用户唯一标识", dataType: "VARCHAR(36)" },
    { name: "name", type: "VARCHAR", required: true, comment: "用户姓名", dataType: "VARCHAR(50)" },
    { name: "my_age", type: "INTEGER", required: false, comment: "用户年龄", dataType: "INT" },
    { name: "sex", type: "CHAR", required: false, comment: "用户性别", dataType: "CHAR(1)" },
    { name: "reg_date", type: "DATE", required: true, comment: "注册日期", dataType: "DATE" }
  ],
  
  // 新增目标表定义
  "目标客户表": [
    { name: "customer_id", type: "VARCHAR", required: true, comment: "客户ID", dataType: "VARCHAR(20)" },
    { name: "full_name", type: "VARCHAR", required: true, comment: "全名", dataType: "VARCHAR(100)" },
    { name: "age", type: "INTEGER", required: false, comment: "年龄", dataType: "INT" },
    { name: "gender", type: "CHAR", required: false, comment: "性别", dataType: "CHAR(1)" },
    { name: "registration_date", type: "DATE", required: true, comment: "注册日期", dataType: "DATE" },
    { name: "customer_level", type: "VARCHAR", required: false, comment: "客户等级", dataType: "VARCHAR(10)" }
  ]
};

// 数据集字段定义 - 新增流水线步骤的字段变化
export const datasetFields = {
  "客户信息表": [
    { name: "customer_id", type: "VARCHAR", required: true, changeType: "none" },
    { name: "full_name", type: "VARCHAR", required: true, changeType: "none" },
    { name: "gender", type: "CHAR", required: false, changeType: "none" },
    { name: "birth_date", type: "DATE", required: false, changeType: "none" },
    { name: "phone", type: "VARCHAR", required: true, changeType: "none" },
    { name: "email", type: "VARCHAR", required: false, changeType: "none" },
    { name: "address", type: "VARCHAR", required: false, changeType: "none" },
    { name: "city", type: "VARCHAR", required: false, changeType: "none" },
    { name: "province", type: "VARCHAR", required: false, changeType: "none" },
    { name: "postal_code", type: "VARCHAR", required: false, changeType: "none" },
    { name: "register_date", type: "TIMESTAMP", required: true, changeType: "none" },
    { name: "last_update", type: "TIMESTAMP", required: true, changeType: "none" },
  ],
  "2": [
    { name: "customer_id", type: "VARCHAR", required: true, changeType: "modified" },
    { name: "full_name", type: "VARCHAR", required: true, changeType: "modified" },
    { name: "gender", type: "CHAR", required: false, changeType: "modified" },
    { name: "birth_date", type: "DATE", required: false, changeType: "modified" },
    { name: "phone", type: "VARCHAR", required: true, changeType: "modified" },
    { name: "email", type: "VARCHAR", required: false, changeType: "modified" },
    { name: "province", type: "VARCHAR", required: false, changeType: "split" },
    { name: "city", type: "VARCHAR", required: false, changeType: "split" },
    { name: "address", type: "VARCHAR", required: false, changeType: "modified" }
  ],
  "3": [
    { name: "customer_id", type: "VARCHAR", required: true, changeType: "none" },
    { name: "full_name", type: "VARCHAR", required: true, changeType: "none" },
    { name: "gender", type: "CHAR", required: false, changeType: "none" },
    { name: "birth_date", type: "DATE", required: false, changeType: "none" },
    { name: "phone", type: "VARCHAR", required: true, changeType: "none" },
    { name: "email", type: "VARCHAR", required: false, changeType: "none" },
    { name: "province", type: "VARCHAR", required: false, changeType: "none" },
    { name: "city", type: "VARCHAR", required: false, changeType: "none" },
    { name: "address", type: "VARCHAR", required: false, changeType: "none" },
    { name: "postal_code", type: "VARCHAR", required: false, changeType: "added" },
    { name: "customer_level", type: "VARCHAR", required: false, changeType: "added" },
    { name: "customer_value", type: "DECIMAL", required: false, changeType: "added" }
  ],
  
  // 新增流水线步骤定义
  "old_customer": [ // 步骤1: 原始数据
    { name: "uuid", type: "VARCHAR", required: true, changeType: "none" },
    { name: "name", type: "VARCHAR", required: true, changeType: "none" },
    { name: "my_age", type: "INTEGER", required: false, changeType: "none" },
    { name: "sex", type: "CHAR", required: false, changeType: "none" },
    { name: "reg_date", type: "DATE", required: true, changeType: "none" }
  ],
  "2": [ // 步骤2: 字段标准化
    { name: "uuid", type: "VARCHAR", required: true, changeType: "modified" },
    { name: "full_name", type: "VARCHAR", required: true, changeType: "added" }, // 新增字段
    { name: "age", type: "INTEGER", required: false, changeType: "modified" },   // 重命名字段
    { name: "gender", type: "CHAR", required: false, changeType: "modified" },   // 重命名字段
    { name: "reg_date", type: "DATE", required: true, changeType: "none" }
  ],
  "3": [ // 步骤3: 数据增强
    { name: "customer_id", type: "VARCHAR", required: true, changeType: "modified" }, // 重命名字段
    { name: "full_name", type: "VARCHAR", required: true, changeType: "none" },
    { name: "age", type: "INTEGER", required: false, changeType: "none" },
    { name: "gender", type: "CHAR", required: false, changeType: "none" },
    { name: "registration_date", type: "DATE", required: true, changeType: "modified" }, // 重命名字段
    { name: "customer_level", type: "VARCHAR", required: false, changeType: "added" } // 新增字段
  ]
};

// 预览数据
export const previewData = {
  "1": {
    title: "原始数据",
    headers: ["cust_id", "姓名", "性别", "出生日期", "电话", "邮箱", "地址"],
    rows: [
      ["C001", "张三", "男", "1985-05-15", "13812345678", "zhangsan@example.com", "北京市海淀区中关村大街1号"],
      ["C002", "李四", "女", "1990-08-22", "13987654321", "lisi@example.com", "上海市浦东新区张江高科技园区"],
      ["C003", "王五", "男", "1978-12-10", "13600001111", "wangwu@example.com", "广州市天河区天河路385号"],
      ["C004", "赵六", "女", "1995-03-30", "13522223333", "zhaoliu@example.com", "深圳市南山区科技园"]
    ],
    columnChanges: {},
    stats: { totalRecords: "4", columns: "7", quality: "92%" }
  },
  "2": {
    title: "字段标准化",
    headers: ["customer_id", "full_name", "gender", "birth_date", "phone", "email", "province", "city", "address"],
    rows: [
      ["C001", "张三", "M", "1985-05-15", "13812345678", "zhangsan@example.com", "北京市", "海淀区", "中关村大街1号"],
      ["C002", "李四", "F", "1990-08-22", "13987654321", "lisi@example.com", "上海市", "浦东新区", "张江高科技园区"],
      ["C003", "王五", "M", "1978-12-10", "13600001111", "wangwu@example.com", "广州市", "天河区", "天河路385号"],
      ["C004", "赵六", "F", "1995-03-30", "13522223333", "zhaoliu@example.com", "深圳市", "南山区", "科技园"]
    ],
    columnChanges: {
      "customer_id": "modified",
      "full_name": "modified",
      "gender": "modified",
      "birth_date": "modified",
      "phone": "modified",
      "email": "modified",
      "province": "split",
      "city": "split",
      "address": "modified"
    },
    stats: { totalRecords: "4", columns: "9", quality: "95%" }
  },
  "3": {
    title: "数据增强",
    headers: ["customer_id", "full_name", "gender", "birth_date", "phone", "email", "province", "city", "address", "postal_code", "customer_level", "customer_value"],
    rows: [
      ["C001", "张三", "M", "1985-05-15", "13812345678", "zhangsan@example.com", "北京市", "海淀区", "中关村大街1号", "100080", "金卡", "8500.00"],
      ["C002", "李四", "F", "1990-08-22", "13987654321", "lisi@example.com", "上海市", "浦东新区", "张江高科技园区", "201203", "银卡", "5200.00"],
      ["C003", "王五", "M", "1978-12-10", "13600001111", "wangwu@example.com", "广州市", "天河区", "天河路385号", "510000", "钻石卡", "12800.00"],
      ["C004", "赵六", "F", "1995-03-30", "13522223333", "zhaoliu@example.com", "深圳市", "南山区", "科技园", "518057", "普通卡", "2100.00"]
    ],
    columnChanges: {
      "postal_code": "added",
      "customer_level": "added",
      "customer_value": "added"
    },
    stats: { totalRecords: "4", columns: "12", quality: "98%" }
  }
};

// 转换详情
export const transformDetails = {
  overview: [
    { label: "总字段数", value: "12" },
    { label: "必填字段", value: "5" },
    { label: "可选字段", value: "7" },
    { label: "数值字段", value: "1" },
    { label: "文本字段", value: "9" },
    { label: "日期字段", value: "2" }
  ],
  columns: [
    { name: "customer_id", fieldType: "主键", required: "是", dataType: "VARCHAR", source: "原始数据" },
    { name: "full_name", fieldType: "基础信息", required: "是", dataType: "VARCHAR", source: "原始数据" },
    { name: "gender", fieldType: "基础信息", required: "否", dataType: "CHAR", source: "原始数据" },
    { name: "birth_date", fieldType: "基础信息", required: "否", dataType: "DATE", source: "原始数据" },
    { name: "phone", fieldType: "联系方式", required: "是", dataType: "VARCHAR", source: "原始数据" },
    { name: "email", fieldType: "联系方式", required: "否", dataType: "VARCHAR", source: "原始数据" },
    { name: "province", fieldType: "地址", required: "否", dataType: "VARCHAR", source: "地址拆分" },
    { name: "city", fieldType: "地址", required: "否", dataType: "VARCHAR", source: "地址拆分" },
    { name: "address", fieldType: "地址", required: "否", dataType: "VARCHAR", source: "原始数据" },
    { name: "postal_code", fieldType: "地址", required: "否", dataType: "VARCHAR", source: "数据增强" },
    { name: "customer_level", fieldType: "客户属性", required: "否", dataType: "VARCHAR", source: "数据增强" },
    { name: "customer_value", fieldType: "客户属性", required: "否", dataType: "DECIMAL", source: "数据增强" }
  ]
};

// 流水线步骤
export const pipelineSteps = [
  {
    id: "1",
    name: "数据源",
    description: "原始客户数据",
    color: "#4285f4",
    icon: "fas fa-database"
  },
  {
    id: "2",
    name: "字段标准化",
    description: "字段名称和格式标准化",
    color: "#34a853",
    icon: "fas fa-sync-alt"
  },
  {
    id: "3",
    name: "数据增强",
    description: "添加客户价值和等级",
    color: "#ea4335",
    icon: "fas fa-plus-circle"
  },
  {
    id: "4",
    name: "数据导出",
    description: "导出到目标数据库",
    color: "#fbbc05",
    icon: "fas fa-file-export"
  }
];

// 图例
export const legends = [
  { text: "新增字段", icon: "fas fa-plus", iconClass: "icon-added" },
  { text: "修改字段", icon: "fas fa-sync-alt", iconClass: "icon-modified" },
  { text: "删除字段", icon: "fas fa-trash", iconClass: "icon-removed" },
  { text: "拆分字段", icon: "fas fa-cut", iconClass: "icon-split" },
  { text: "聚合字段", icon: "fas fa-object-group", iconClass: "icon-aggregate" }
];

// 字段映射
export const fieldMappings = {
  "cust_id": "customer_id",
  "姓名": "full_name",
  "性别": "gender",
  "出生日期": "birth_date",
  "电话": "phone",
  "邮箱": "email",
  "地址": "address"
};
